package Entities; //done

import GUI.CustomerWindow;
import GUI.CustomerSearchWindow;

import java.awt.HeadlessException;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
 * This class controlls Customer Contact Employee functions.
 * @author waleed
 * @author ameer
 * @author kamel
 * @author bshara
 */
public class CustomerContactEmployee{

	/**
	 * This function opens AddCustomerForm
	 */
	public void addCustomer(){
		try{
			JFrame jframe = new JFrame();
			CustomerWindow customerWindow = new CustomerWindow();
			customerWindow.addSaveButton();
			jframe.setBounds(500,150,350, 300);
			jframe.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
			
			JLabel BackgroundLabel = new JLabel("");
			BackgroundLabel.setIcon(new ImageIcon(CustomerWindow.class.getResource("/Pictures/bg.png")));
			BackgroundLabel.setBounds(0, 0, 350, 300);
			customerWindow.add(BackgroundLabel);
			
			jframe.setContentPane(customerWindow);
			customerWindow.getCancelButton().addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					;							
				}
			});
			jframe.setTitle("Add Customer");
			jframe.setVisible(true);
		}
		catch(HeadlessException headlessexception){
			JOptionPane.showMessageDialog(null, "FATAL ERROR");
		}	
	}	
	
	/**
	 * This function opens UpdateCustomerForm
	 */
	public void UpdateCustomer(){
		try{
			CustomerSearchWindow customersearch = new CustomerSearchWindow("UpdateCustomer");
			customersearch.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE);
			customersearch.setBounds(500,150,400,280); 
			customersearch.setVisible( true ); 
		}
		catch(HeadlessException headlessexception){
			JOptionPane.showMessageDialog(null, "FATAL ERROR","",JOptionPane.ERROR_MESSAGE);
		}	
	}
}
